from PyQt5.Qt import *
import sys

class Window(QWidget):
    def __init__(self):
        super().__init__()
        self.setWindowTitle('装饰器')
        self.resize(600,400)
        self.add2Btn()

    def add2Btn(self):
        btn1 = QPushButton(self)
        btn1.setObjectName('btn')
        btn1.resize(200,50)
        btn1.move(100,50)
        btn1.setText('按钮1')
        btn1.clicked.connect(self.btn1Click)
        btn1.clicked.connect(self.showIt)


        btn2 = QPushButton(self)
        btn2.setObjectName('btn2')
        btn2.setText('按钮2')
        btn2.resize(200, 50)
        btn2.move(100, 150)
        btn1.clicked.connect(btn2.click)
        QMetaObject.connectSlotsByName(self)

    def btn1Click(self):
        print('111111')
    def showIt(self):
        print('22222')

    @pyqtSlot(bool)
    def on_btn2_clicked(self):
        print('3333333')


if __name__ == "__main__":
    app = QApplication(sys.argv)
    w1 = Window()
    w1.show()
    sys.exit(app.exec_())